a=arm64;if [[ $(uname -a | grep "x86_64") != "" ]];then a=amd64;fi ;s=sillyGirl;cd;if [ ! -d $s ];then mkdir $s;fi ;cd $s;wget https://mirror.ghproxy.com/https://github.com/cdle/${s}/releases/download/main/${s}_linux_$a -O $s && chmod 777 $s &&pkill -9 $s ; #$(pwd)/$s


./sillyGirl -d

cd /usr/local && wget https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz

xz -dk node-v16.13.1-linux-x64.tar.xz && tar -xvf node-v16.13.1-linux-x64.tar

if [[ ! `grep NODE_HOME /etc/profile` ]];then
cat >>/etc/profile <<-EOF

export NODE_HOME=/usr/local/node-v16.13.1-linux-x64
export PATH=\$PATH:\$NODE_HOME/bin
export NODE_PATH=\$NODE_HOME/lib/node_modules
EOF
fi

source /etc/profile

node -v 

npm install pm2 -g

pm2 list

cd ~

stty erase ^? && read -p "输入管理员QQ:" GLYQQ
s=/etc/sillyGirl;if [ ! -d $s ];then mkdir $s; fi; grep -q $GLYQQ /etc/sillyGirl/sets.conf || echo "set qq masters $GLYQQ" >> /etc/sillyGirl/sets.conf

if [[ ! `grep enable_http_server /etc/sillyGirl/sets.conf` ]];then
cat >>/etc/sillyGirl/sets.conf <<-EOF
set sillyGirl enable_http_server true
set sillyGirl port 8080
EOF
fi

cd /root/sillyGirl && ./sillyGirl -d

[ -e  /root/node-onebot ] && rm -rf /root/node-onebot

cd && git clone https://ghproxy.com/https://github.com/takayama-lily/node-onebot.git

cd /root/node-onebot

cp config.sample.js config.js

sed -i "s/\/\/ \"ws:\/\/your.address.com:8080/\"ws:\/\/127.0.0.1:8080\/qq\/receive/g" /root/node-onebot/config.js

stty erase ^? && read -p "输入机器人QQ号:" JQRQQ 
cd && cd node-onebot && node main $JQRQQ

pm2 start "node main $JQRQQ"

echo "
##傻妞命令写入
cat >>/etc/sillyGirl/sets.conf <<-EOF

#这里放你的命令;一条命令一行

EOF

##自启
cd node-onebot && pm2 start \"node main 机器QQ号\"
cd && pm2 start \"./sillyGirl/sillyGirl -d\"
pm2 save && pm2 startup

"